package com.youku.controls
{
   import com.youku.plugins.shareV4.ShareFacade;
   import com.youku.GlobalService;
   import com.youku.GlobalServiceKeys;
   import com.youku.events.PluginEvent;
   import com.youku.events.PlayerControlEvent;
   import com.youku.data.PlayerConstant;
   
   public class ShareV4Controller extends BasePluginController
   {
      
      public function ShareV4Controller() {
         super();
         this.init();
      }
      
      private var _shareFacade:ShareFacade;
      
      override protected function init() : void {
         this._shareFacade = ShareFacade.getInstance();
         this._shareFacade.init(viewManager.pluginLayer,playerProxy);
         GlobalService.addService(GlobalServiceKeys.SHARE_FACADE,playerProxy);
         playerProxy.addEventListener(PluginEvent.SHARE_CLOSE,this.onShareBoxEvent);
      }
      
      private function onShareBoxEvent(param1:PluginEvent) : void {
         switch(param1.type)
         {
            case PluginEvent.SHARE_CLOSE:
               playerProxy.dispatchEvent(new PlayerControlEvent(PlayerControlEvent.AFTER_CLOSE_PANELS,{"panel":PlayerConstant.PANEL_SHARE}));
               break;
         }
      }
   }
}
